local ClientOHOH = _G.ClientOHOH;

local M = ClientOHOH.class.new(script, ClientOHOH.files.OHOHOLYBUIBase());


function InitInsts(ui)
	ui.insts = {
        atk="ctrl.HP",--攻击力
        wpn="ctrl.AttackSpeed",--武器伤害
        level="ctrl.Level",--等级
    
        equipText="ctrl.eqtext",--装备按钮文本
        name="ctrl.name",--名字
        sellCount="ctrl.val_sell",--售卖价格
        upgradeCount="ctrl.val_upgrade",--升级消耗
        sellIcon="ctrl.sellIcon",--售卖Icon
        upgradeIcon="ctrl.upgradeIcon",--升级Icon
    
        equip_btn="ctrl.btn_equip",--装备按钮
        sell_btn="ctrl.btn_sell",--售卖按钮
        upgrade_btn="ctrl.btn_upgrade",--升级按钮
        invite_btn="ctrl.invite",--邀请好友
        weapon_btn="ctrl.weapon",--切换武器
    };
end;

function M.new(...)
	return M(...);
end;

function M.ctor(self,uiobj)
    InitInsts(self)

	M.super.ctor(self, uiobj);   
    self.uiObject=uiobj
    
    self:Clear()
end;

function M.dtor(self)
	M.super.dtor(self);
    self.uiObject:Destroy()
end;


function M.GetUiInsts(self)
    return self.insts
end

local BigNumberHelper = ClientOHOH.load.BigNumberHelper();


function M.Clear(self)
    self.insts.level.Text="???"
    self.insts.name.Text="???"
    self.insts.atk.Text="???"
    self.insts.wpn.Text="???"
    self.insts.sellCount.Text="???"
    self.insts.upgradeCount.Text="???"
    self.insts.equipText.Text="???"
end
--更新
function M.FullUi(self,isEquip,upgrade,sell,level,name,wpn,atk)

    self.insts.level.Text=level
    self.insts.name.Text=name
    self.insts.wpn.Text=wpn
    self.insts.atk.Text=atk

    --设置售卖信息
    for k,v in pairs(sell) do
        local image=  _G.CommonOHOH.load.ItemTool().GetItemShowView(k)
        self.insts.sellIcon.Image=image
        self.insts.sellCount.Text=BigNumberHelper:ToString(v)
    end

    --设置升级信息
    for k,v in pairs(upgrade) do
        local image=  _G.CommonOHOH.load.ItemTool().GetItemShowView(k)
        self.insts.upgradeIcon.Image=image
        self.insts.upgradeCount.Text=BigNumberHelper:ToString(v)
    end

    --装备状态更新
     if isEquip then
        self.insts.equipText.Text=_G.LanguageHelper:GetText(13)
       
     else
        self.insts.equipText.Text=_G.LanguageHelper:GetText(30064)
     end



end

return M